import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_example/page/my_home_page.dart';

class MySplashPage extends StatefulWidget {
  static const String route = "/MySplashPage";
  const MySplashPage({super.key});

  @override
  State<MySplashPage> createState() => _MySplashPageState();
}

class _MySplashPageState extends State<MySplashPage> {
  @override
  void initState() {
    super.initState();

    //延时函数
    Future.delayed(const Duration(seconds: 2), () {
      Get.offAllNamed(MyHomePage.route);
    });
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(
        child: Text("MySplash 开机页面"),
      ),
    );
  }
}
